const { ccclass, property } = cc._decorator;

@ccclass
export default class PoolManager {
    static initPool(pool, size, prefab) {
        pool = new cc.NodePool();
        for (let i = 0; i < size; i++) {
            let item = cc.instantiate(prefab);
            pool.put(item);
        }
    }

    static createItemByPool(pool, prefab) {
        return pool.size() > 0 ? pool.get() : cc.instantiate(prefab);
    }

    static recycleToPool(pool, item) {
        pool.put(item);
    }
}